//引入vue模块
import vue from "vue";
//下载路由,引进来
import vueRouter from "vue-router";
//使用路由
vue.use(vueRouter);

import home from "../components/home.vue";
import recommend from "../components/recommend.vue";
import hotsong from "../components/hotsong.vue";
import detail from "../components/detail.vue";
import index from "../components/index.vue";
import songdetail from "../components/songdetail.vue";
import songList from "../components/songList.vue";
import hotComment from "../components/hotComment.vue";
import comments from "../components/comments.vue";

//配置路由
const route = [
    {
        path:"",
        component:index,
        name:"index",
        redirect:"/index",
        children:[
            {path:"",redirect:"home" },
            {path:"home",component:home},
            {path:"recommend",component:recommend},
            {path:"hotsong",component:hotsong},
        ]
    },
    {
        path:"/detail",
        component:detail,
        name:"detail",

        children:[
            {path:"",redirect:"songList" },
            {path:"songList",component:songList },
            {path:"hotComment",component:hotComment},
            {path:"comments",component:comments},
        ]
    },
    {
        path:"/songdetail",
        component:songdetail,
        name:"songdetail"
    }
   
    
]


//创建路由实例
const router = new vueRouter({
    routes:route
})
//输出router实例
export default router;